﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using BlueLotus7.ArchiveSystem.Interfaces;
using System.ServiceModel;
using System.ServiceModel.Channels;
using BlueLotus7.ArchiveSystem.Common;

namespace BlueLotus7.ArchiveSystem.WCFClients
{
    public partial class ArchiveStatusServiceClient : ClientBase<IArchiveStatusService>, IArchiveStatusService
    {
        #region Constructor

        public ArchiveStatusServiceClient()
        {
        }

        public ArchiveStatusServiceClient(string endpointConfigurationName)
            : base(endpointConfigurationName)
        {
        }

        public ArchiveStatusServiceClient(string endpointConfigurationName, string remoteAddress)
            : base(endpointConfigurationName, remoteAddress)
        {
        }

        public ArchiveStatusServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress)
            : base(endpointConfigurationName, remoteAddress)
        {
        }

        public ArchiveStatusServiceClient(Binding binding, EndpointAddress remoteAddress)
            : base(binding, remoteAddress)
        {
        }

        #endregion

        public bool ReportStatus(Guid monitorClientKey, Guid domainScopeKey, Guid domainScopeUserKey, int status)
        {
            return this.Channel.ReportStatus(monitorClientKey, domainScopeKey, domainScopeUserKey, status);
        }

        public List<TargetStatus> QueryStatus(Guid? domainScopeKey, Guid? domainScopeUserKey, DateTime? startStamp, DateTime? endStamp)
        {
            return this.Channel.QueryStatus(domainScopeKey, domainScopeUserKey, startStamp, endStamp);
        }

        public TargetStatus RetrieveLatestStatus(Guid domainScopeKey, Guid domainScopeUserKey)
        {
            return this.Channel.RetrieveLatestStatus(domainScopeKey, domainScopeUserKey);
        }

        public List<DomainScopeUser> RetrieveScopeUsersToMonitor(Guid domainScopeKey, Guid monitorClientKey)
        {
            return this.Channel.RetrieveScopeUsersToMonitor(domainScopeKey, monitorClientKey);
        }

        public Guid? AddOrUpdateDomainScope(DomainScope domainScope)
        {
            return this.Channel.AddOrUpdateDomainScope(domainScope);
        }

        public List<DomainScope> QueryDomainScopeList(DomainScopeType? domainScopeType, string keywords)
        {
            return this.Channel.QueryDomainScopeList(domainScopeType, keywords);
        }

        public DomainScope GetDomainScopeByKey(Guid key)
        {
            return this.Channel.GetDomainScopeByKey(key);
        }

        public Guid? AddOrUpdateScopeUser(DomainScopeUser user)
        {
            return this.Channel.AddOrUpdateScopeUser(user);
        }

        public List<DomainScopeUser> QueryDomainScopeUsers(Guid? scopeKey, string identityKeyword)
        {
            return this.Channel.QueryDomainScopeUsers(scopeKey, identityKeyword);
        }

        public DomainScopeUser GetDomainScopeUserByKey(Guid key)
        {
            return this.Channel.GetDomainScopeUserByKey(key);
        }

        public List<MonitorClient> GetMonitorClients()
        {
            return this.Channel.GetMonitorClients();
        }

        public MonitorClient GetMonitorClientByKey(Guid monitorClientKey)
        {
            return this.Channel.GetMonitorClientByKey(monitorClientKey);
        }

        public Guid? AddMonitorClient(MonitorClient client)
        {
            return this.Channel.AddMonitorClient(client);
        }

        public bool UpdateMonitorClient(MonitorClient client)
        {
            return this.Channel.UpdateMonitorClient(client);
        }

        public List<ClientHeartbeat> QueryClientHearbeat(Guid? clientKey, int topCount)
        {
            return this.Channel.QueryClientHearbeat(clientKey, topCount);
        }

        public bool CreateClientHeartbeat(Guid clientKey, DateTime lastSettingStamp)
        {
            return this.Channel.CreateClientHeartbeat(clientKey, lastSettingStamp);
        }

        public Guid? AddOrUpdateMonitorTask(MonitorTask task)
        {
            return this.Channel.AddOrUpdateMonitorTask(task);
        }

        public List<ReportableTask> GetMonitorTaskByClientKey(Guid clientKey, bool includeDisabled)
        {
            return this.Channel.GetMonitorTaskByClientKey(clientKey, includeDisabled);
        }

        public ReportableTask GetMonitorTaskByKey(Guid key)
        {
            return this.Channel.GetMonitorTaskByKey(key);
        }

        public List<ReportableTask> QueryMonitorTasks(string name, Guid? clientKey, MonitorTask.TaskExecutionType? executionType, string thirdPartyIdentity, bool? isNightOperationOnly, bool? isDisabled)
        {
            return this.Channel.QueryMonitorTasks(name, clientKey, executionType, thirdPartyIdentity, isNightOperationOnly, isDisabled);
        }

        public void MergeStatus(Guid domainScopeUserKey, int status, Guid startGuid, Guid endGuid)
        {
            this.Channel.MergeStatus(domainScopeUserKey, status, startGuid, endGuid);
        }

        public List<DomainScopeUserFullInfo> GetDomainScopeUsersWithStatus(Guid? domainScopeKey)
        {
            return this.Channel.GetDomainScopeUsersWithStatus(domainScopeKey);
        }

        public DomainScope GetDomainScopeByCode(string code)
        {
            return this.Channel.GetDomainScopeByCode(code);
        }
    }
}
